﻿using Microsoft.AspNetCore.Mvc;
using mozhi.smarterp.Finance.Querys;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Volo.Abp;

namespace mozhi.smarterp.Finance.Finances
{
    [RemoteService]
    [Route("api/v1/endperiodprocess")]
    public class EndPeriodProcessController : BaseController
    {
        private IEndPeriodProcessResultAppService _appService;
        public EndPeriodProcessController(IEndPeriodProcessResultAppService appService)
        {
            _appService = appService;
        }

        [HttpGet]
        public async Task<List<EndPeriodProcessResultDto>> GetAsync(EndPeriodProcessResultQuery query)
        {
            var result = await _appService.FindAsync(query);

            return result;
        }


        [HttpGet]
        [Route("item/{itemId}")]
        public async Task<EndPeriodProcessResultDto> GetAsync(Guid itemId)
        {
            var result = await _appService.GetAsync(itemId);

            return result;
        }

        [HttpPost]
        [Route("measure")]
        public async Task<EndPeriodProcessResultDto> GetMeasureAsync(EndPeriodProcessResultCreateDto dto)
        {
            var result = await _appService.MeasureAsync(dto);

            return result;
        }
    }
}
